#pragma once
#include "stdarg.h"
#include "comm/types.h"
#include "tools/log.h"

//转换为整数倍
static inline uint32_t down2(uint32_t size,uint32_t bound)
{
    return size &~ (bound-1);   
}
static inline uint32_t up2(uint32_t size,uint32_t bound)
{ 
    return (size+bound-1) &~ (bound-1);
}

void kernel_strcpy (char * dest, const char * src);
void kernel_strncpy(char * dest, const char * src, int size);
int kernel_strncmp (const char * s1, const char * s2, int size);
int kernel_strlen(const char * str);
void kernel_memcpy (void * dest, void * src, int size);
void kernel_memset(void * dest, uint8_t v, int size);
int kernel_memcmp (void * d1, void * d2, int size);
void kernel_vsprintf(char* buff, const char* mssage,va_list args);
void kernel_sprintf(char * buffer, const char * fmt, ...);
void pannic(const char * file,int line,const char* func,const char* cond);

#ifndef RELESE

#define ASSERT(expr) if(!(expr)) pannic(__FILE__, __LINE__, __func__, #expr)

#else

#define ASSERT(expr) ((void)0)

#endif


int strings_count(char** str);
char* get_file_name(const char* name);